imageGalleryFromFolder Plugin class
This class reads an folder and creates a gallery out of the pictures in it.
Also looks if a "texts.txt" or "captions.txt" exists, to get image captions. The captions in this file must have the following format: filename.jpg###Text which sould apear under the image, when zoomed in otherFilname.png###Another text which describes the picture ...
Note: works only with "png", "gif" and "jpg" or "jpeg" filetypes. Note: The image gallery is surrounded by an '<div class="feinduraPlugin_imageGalleryFromFolder">' tag to help to style the image gallery.
int | $documentRoot | You can set the document root manually. |
bool | $xHtml | TRUE when the pages content should be handled as XHTML |
int | $resizeWhenSmaller | TRUE when images shopuld also be resized, even if they are smaller, than the set width, or height values. |
int | $keepRatio | If TRUE the original ratio will be used, when resizing the images. |
int | $imageWidth | The maximal width of the pictures |
int | $imageHeight | The maximal height of the pictures |
int | $thumbnailWidth | The maximal width of the thumbnails of the pictures |
int | $thumbnailHeight | The maximal height of the thumbnails of the pictures |
bool | $emptyImage | A path to and 1px x 1px empty gif image, which is needed when adding the image as background when specifing width and height. |
bool | $filenameCaptions | If this is TRUE it uses the filename as captions, when no line in a captions.txt exist for this file. |
array | $images | An array which contains all image filenames and paths |
string | $galleryPath | The absolute path to the gallery |
string | $title | The title of the gallery, retrieved from the "title.txt" |
string | $previewImage | The image which is shown as the preview image of the gallery, retrieved from the "previewImage.txt" |
int | $lastModification | the timestamp of the latest modification of the files |
int | $uniqueId | A unique ID which each imageGalleryFromFolder gets to separate them. |
void | __construct() | The constructor of the class, sets all basic properties. Also looks if a "texts.txt" or... |
array|false | readFolder() | Reads a folder and return it's files. |
bool | resizeImages() | Resize the images to the size set in the imageGalleryFromFolder::$imageWidth and... |
bool | createThumbnails() | Resize the images to the size set in the imageGalleryFromFolder::$thumbnailWidth and... |
array | getImages() | Generates the image links and return them in an array. When both the thumbnail width and height are set, then it... |
string | createLinkToGallery() | Generates a link to the gallery which shows the preview image and the gallery title . |
string | showGallery() | Generates the gallery for displaying in an HTML-page Note : The image gallery is surrounded by an '<div... |
TRUE when the pages content should be handled as XHTML
In XHTML standalone tags end with " />" instead of ">".
Therefor when a page content is displayed and this property is FALSE all " />" will be changed to ">".
TRUE when images shopuld also be resized, even if they are smaller, than the set width, or height values.
If TRUE the original ratio will be used, when resizing the images.
If this property is FALSE and only width or height is set, it even though keeps the ratio.
The maximal width of the pictures
All pictures will be resized to this width when the imageGalleryFromFolder::resizeImages() method is called.
Note: If the imageGalleryFromFolder::$imageHeight property is null, it keeps the aspect ratio of the images.
The maximal height of the pictures
All pictures will be resized to this height when the resizeImages() method is called.
Note: If the imageGalleryFromFolder::$imageWidth property is null, it keeps the aspect ratio of the images.
The maximal width of the thumbnails of the pictures
the thumbnails will be created with this width when the imageGalleryFromFolder::createThumbanils() method is called.
Note: If the imageGalleryFromFolder::$thumbnailHeight property is null, it keeps the aspect ratio of the images.
The maximal height of the thumbnails of the pictures
the thumbnails will be created with this height when the imageGalleryFromFolder::createThumbanils() method is called.
Note: If the imageGalleryFromFolder::$thumbnailWidth property is null, it keeps the aspect ratio of the images.
A path to and 1px x 1px empty gif image, which is needed when adding the image as background when specifing width and height.
If this is TRUE it uses the filename as captions, when no line in a captions.txt exist for this file.
The absolute path to the gallery
The title of the gallery, retrieved from the "title.txt"
The image which is shown as the preview image of the gallery, retrieved from the "previewImage.txt"
the timestamp of the latest modification of the files
string | $folder |
the absolut path of the folder from where a gallery should be created |
$documentRoot |
Default false |
Type constructor
The constructor of the class, sets all basic properties.
Also looks if a "texts.txt" or "captions.txt" exists, to get image captions. The captions in this file must have the following format: filename.jpg###Text which sould apear under the image, when zoomed in otherFilname.png###Another text which describes the picture ...
string | $folder |
the absolute path of an folder to read |
Name readFolder()
Reads a folder and return it's files.
Name resizeImages()
Resize the images to the size set in the imageGalleryFromFolder::$imageWidth and imageGalleryFromFolder::$imageHeight property.
Name createThumbnails()
Resize the images to the size set in the imageGalleryFromFolder::$thumbnailWidth and imageGalleryFromFolder::$thumbnailHeight property and copy them to a "thumbnails/" subfolder.
Name getImages()
Generates the image links and return them in an array. When both the thumbnail width and height are set, then it will add the image as background to the <img> tag. This ensures that all images have the same size.
Name createLinkToGallery()
Generates a link to the gallery which shows the preview image and the gallery title.
string showGallery ( |
string $tag, [int $breakAfter = false], [array $pageContent = false]) |
string | $tag |
the tag used to create the gallery, can be "ul","menu", "table" or FALSE to return just images |
int | $breakAfter |
(optional) if the $tag parameter is "table" then it defines the number after which the table makes a new row Default false |
array | $pageContent |
(optional) the $pageContent array of the page which uses the plugin, to compare the last edit date with the one from the "lastmodification.log" Default false |
Name showGallery()
Generates the gallery for displaying in an HTML-page
Note: The image gallery is surrounded by an '<div class="feinduraPlugin_imageGalleryFromFolder">' tag to help to style the image gallery.